package main

import (
	"example/main/mq_service"
	"fmt"
	"time"
)

func main() {
	mq, err := mq_service.NewMqServer()
	fmt.Println(mq)
	if err != nil {
		fmt.Println(err.Error())
		return
	}
	mq.MulReceiveMsg("sp_report_ids", MsgHandle, 4)
	//for i := 0; i < 10; i++ {
	//	go func (i int) {
	//		log.Println("go-", i)
	//		mq.ReceiveMsg("sp_report_ids", MsgHandle)
	//	}(i)
	//}

	return
}

func MsgHandle(msg []byte) error {
	time.Sleep(1 * time.Second)
	//time.Sleep(500 * time.Millisecond)
	fmt.Println(string(msg))
	return nil
}


